<template>
	<view class="consult-list">
		<view class="consult-list-title">
			专业服务
		</view>
		<view class="consult-list-wrapper">
			<view class="consult-method-item">
				<view class="consult-item-icon">
					<u-image
						src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-8acfaa58-aeb5-4502-8309-365d4c6cca4a/4d2479d5-c9d3-45fd-9450-d585c4ac4675.png"
						width="100%" height="100%" />
				</view>
				<view class="consult-item-right">
					<view class="consult-info">
						<view class="consult-tilte">
							快速咨询
						</view>
						<view class="consult-describe">
							律师在线提供专业解决建议
						</view>
					</view>
					<button class="to-consult-btn" @click="toQuicklyConsult">{{userInfo?userInfo.vip>0?'会员免支付':`￥${quicklyPrice}咨询`:`￥${quicklyPrice}咨询`}}</button>
				</view>
			</view>
			<view class="consult-method-item">
				<view class="consult-item-icon">
					<u-image
						src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-8acfaa58-aeb5-4502-8309-365d4c6cca4a/5b79584e-3254-4dbc-8cf9-475572d2125a.png"
						width="100%" height="100%" />
				</view>
				<view class="consult-item-right">
					<view class="consult-info">
						<view class="consult-tilte">
							电话咨询
						</view>
						<view class="consult-describe">
							律师在线提供专业解决建议
						</view>
					</view>
					<button class="to-consult-btn"
						@click="$u.route(`/pages/phone_consult/phoneConsult?lawyerId=${lawyerDetailData.id}`)">{{userInfo?userInfo.vip>0?'会员免支付':`￥${mobilePrice}咨询`:`￥${mobilePrice}咨询`}}</button>
				</view>
			</view>
			<view class="consult-method-item">
				<view class="consult-item-icon">
					<u-image
						src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-8acfaa58-aeb5-4502-8309-365d4c6cca4a/c99d9435-9e7c-442f-b5c2-bd274cd3b8af.png"
						width="100%" height="100%" />
				</view>
				<view class="consult-item-right">
					<view class="consult-info">
						<view class="consult-tilte">
							案件分析
						</view>
						<view class="consult-describe">
							律师在线提供专业解决建议
						</view>
					</view>
					<button class="to-consult-btn"
						@click="$u.route(`/pages/form_consult/formConsult?lawyerId=${lawyerDetailData.id}`)">{{userInfo?userInfo.vip>0?'会员免支付':`￥${analysisPrice}咨询`:`￥${analysisPrice}咨询`}}</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		created() {
			this.$u.post(this.$restUrl.getQuicklyConsultPrice).then(res => {
				this.quicklyPrice = res.data.consult_price;
				this.quicklyPrice = this.quicklyPrice.split('.')[1]?this.quicklyPrice:this.quicklyPrice+'.00'
			})
			this.$u.post(this.$restUrl.getCaseAnalysisPrice).then(res => {
				this.analysisPrice = res.data.price;
				this.analysisPrice = this.analysisPrice.split('.')[1]?this.analysisPrice:this.analysisPrice+'.00'
			})
			this.$u.post(this.$restUrl.getMobileConsultPrice, {
				model_type: 6
			}).then(res => {
				this.mobilePrice = res.data.price;
				this.mobilePrice = this.mobilePrice.split('.')[1]?this.mobilePrice:this.mobilePrice+'.00'
			})
		},
		props: {
			lawyerDetailData: {
				type: Object,
			}
		},
		data() {
			return {
				quicklyPrice: '',
				mobilePrice: '',
				analysisPrice: '',
			}
		},
		methods: {
			toQuicklyConsult() {
				uni.switchTab({
					url: '/pages/consult/consult',
					success: () => {
						this.$u.vuex('currentLawyerId', this.lawyerDetailData.id);
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import "./consultList.scss";
</style>
